package cn.wolfcode.p2p.website.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.wolfcode.p2p.base.service.IVerifyCodeService;
import cn.wolfcode.p2p.base.util.JSONResult;

/**
 * 验证码的控制器类
 */
@Controller
public class VerifyCodeController {

    @Autowired
    private IVerifyCodeService verifyCodeService;


    //根据手机号码生成验证码
    @PostMapping("/sendVerifyCode")
    @ResponseBody
    public Object sendVerifyCode(String phoneNumber){
        JSONResult result = new JSONResult();
        try {
            verifyCodeService.sendVerifyCode(phoneNumber);
        } catch (Exception e) {
            e.printStackTrace();
            result.mark(e.getMessage());
        }
        return result;
    }



}
